Refactor to seperate methods, cleanup phpunit bootstrap