code cleanup + validation cleanup