updated mem access, moved header