Small restructuring
small fixes
Merge branch 'dev'