Simplified the code slightly. Starting to test command order.