Added tests and cleaned up TTY