logic almost completed