Should be full code, not debugged, some test printing added