cleaned up code and added comments
added support for JMX
added email notification