Add some more error checking to program.cpp

And move some logic into program_FPGA().

--BRJ