Fixed indexoutofbounds exception when no commands were typed yet, added more comments