added validatePresence() and optimized js