Refactoring of command execution
Add pseudo tty support to command execution