added up logic and output