clean up and basic validation