Altered how factotization works, allowing caller to pass buffer so memory isn't allocated