initial refactor
Merge origin/master