add factorial func
fix formating a bit