cleaned up program class and inlined a few functions