Updated factorial code to pass first three tests