Divided error handling & character comments into two different functions.