Add factory girl

Added factory girl and refactored code so that it uses factory girl.
Inconsistent indentation detected.