Code cleanup and remove unnecessary error message text