What is the legal definition of a resident and does it change from state to state?