refactors code
updates to use erb.