Refactored code, according to Symfony Best Practices