Moved lots of logic to the stage