Code cleanup. Now to actually fixing.