updated - separating out the methods cleaning up initial code.