second stage refactoring for laravel 5.0