Remove unused stuff, clean up the code a bit.