WIP
WIP: minor fix
WIP: removed unused code & improved encapsulation