refactoring - helper functions to helpers.rb