Some cleanup, refactors