Refactor signup validation code