closing terminal when code == empty; no negative memory value; fixed bugs