made types consistent with the ones of Hack
made usage of return; instead of return null;