added support for using multiple instances in one page