Change to use composer autoloading and refactor code