better validation
minor tweaks.
more refactor.