scanner almost completed. debug and check