update to mostly correct but wrong algorithm