Reverted to some of the old logic now that we are not using codemirror