Added support for multiple outlets. Bug fixes and improvements