Change to use composer autoload and refactor code