added logic to count up amount