refactored php