Terminal code for assignment 2