more work on factories, I forgot the validators. Refactored some code