Main program now works