Re-rolled patch #44, Fixed phpcs issues. Attached interdiff for same.