Use more railsy conventions and fix bugs