Critical errors fixed in code (some syntax mistakes fixed and a missing 'require' added).