More PHP warning messages and some basic code cleanup