A bunch of refactoring. Much sleep was lost to bring this to you.