Minor - refactor code.
Minor - fixing PHP warnings.
Minor - fixing PHP warnings.