Add type specs to factorial module and rename function