deleted some comments and spaces, added validation