Refactor so that '=> NULL' and 'goto' are gone