Updated plugin to work with ES RC1 and cleaned up some code