refactor and add autoloading with composer