restructured and finished assignment 1