Refactoring

@slajax - I think should be good now.