Added factorial and log functions