improved rails code through using symbols and new hash writing