Finished program. added comments