Added an option to toggle error class