Improve command execution code

Fixes use of $() into more standard `` syntax.