General fixes and cleanup

Change-Id: I131749779c06df4ddde7802275db144222e4da5a
Format PHP code per MW conventions

Change-Id: I17c5d39e9ac0915ab40e465ad86395b06140d97c
Use single quotes where possible

Change-Id: I892e1fc7a4f65ce1588f258fa10c81e0cd0ceeeb
Fix spelling errors in comments

Change-Id: I95070e339b9128153270bd2c37b2854715898646