further work on stage refactoring