assignment 3, completed first 2 parts