Add methods and fix factorial.