Implemented reset password functionality and fixed some bugs