Trying to modify some pre-written code to scan octants