refact some code
Merge pull request #390 from devton/mini_refact

refact some code