Miscellaneous fixes

Validating function didn't work quite right when it came to required fields.
Fixed some of the addType function logic
Converted tabs to spaces