Refactors validators and adds username validator and unit tests.