cleaned up code using rails best practise gem & started writing tests