refine and finish basic signup function