Cleaned up code in preparation for subshell command parsing.