Made some modifications to work in laravel 4