refactor signup procedure