Added PyYAML to dependencies
Moved parsing and command generation out of the main loop