Fixed needle coordinate calculation, left in demo code for now.