Minor refactoring (variable names).
Improved command detection.
Implemented basic support for aliases.