imported memlib from 15-213