a lot of refactoring and aditional queue stuff
adding some grammar stuff