Remove old code and fix old php errors