Adds code enhancments,Dry'd up some code and adds new helper method