Work on mem stuff and tests