Updated to use subprocess tools. Not complete yet.