Restructed some code

and made it more composer/packagist friendly