Refactoring code per Larry's code review.

Implemented generic get function.