More plugin stuff, prettied up some code