Refactored for Silex