some code cleanup
Merge pull request #2004 from agchou/clean-up-code

some code clean up