code cleanup and comments
Merge pull request #35 from rgbkrk/ref

code cleanup and comments