Fixing bugs and removing hacks.