added password matching check to forms class and moved and improved error handling