Some cleanup, better structure.