Program only outputs relevant commands, outputs total at the end