added precomputed_amount algorithm