Refactor code and update factory girl