Added missing return statement, various other things