Added boolean function to code and corrected syntax errors.