program now works (somewhat)