Completed ex4_1, made some additions to make it user friendly