Refactor

Merge refactor branch to master branch