Fixed command detection and removed unused import