100% test coverage, yay!
Also some cleanup in stacks.py and misc bugfix