using mem a bit better