semi-final version without return statement check