Refactor code to not use string class_eval unnecessarily