Minor cleanup, the code is still horrible