ALGORITHM WORKING! (printouts looked good by eye) but accuracy a problem...