improve code quality
Merge pull request #111 from hlee/master

refact a little