Modified code to try and get the commands to work.