Implement read + main program loop