final hw2 code for rshell