Fixing undefined variable, adding docblocks