Added validation, better error reporting, and brafton hooks