Some serious refactor + testing for compatibility with laravel 4.2