Create a generic factory