fully working HW 3 with external library
-IO lib still needs comments