added return statement for factorial