added availableAmount as input parameter