Updates main class to fix an error which was crashing the app when a record was null