Refactor some code, mainly try to figure out how to validate forms