Improve performance slightly, remove debug code.