added support for many stages