code final, comments still to do