added code and figures to complete assignment