correct hashing of passwords using bcrypt
improved validation and error logging; general cleanup