abstracting class names has-error has-success

and cleaning up some code