Debugged the final errors, by removing "var" from within the tertiary condition