Major rewrite for most passes

We still have three passes that need to be dealt with