cleaned up WEM, added dirty bits