Cleaned code for 1.7 stuff.