Improving code and upgrading php requirement