trying to refactor the helper method
somewhat working