Added condition to prevent infinite loops in the client and server actions
Added 2 new inputs:
Updated calculation flow