Switch to long hand php code, fixes #6