Added password encryption and some more code cleanup