Fixed a few bugs and added the commands queue