Adds factors function.