Added factorial functionality