Moved some code around. ALSO: This is now broken on Windows 8.