Added password encryption and ooptimized JavaScript