Still a bit of a mess but I've cleaned up the stacks stuff and all tests are passing