Some initial code clean up before we begin documenting

Fixing what appear to be some syntactic mis-named variables and adding some other drupal standard code.