Fixed bugs, added support for multiple pools