Created a function to consolidate redundant code and also fixed a bug when evaling ' \n\r" '