code cleanup + fix forms