clean up, add some validation