migration to php 5.5 and refactoring