Added e command and beefed up error check