Error handling reworked (finally!), internalCommand divided into several functions