Added AngularJS input validation, general code cleanup