Improved functions and fixed commands