Basic generic factory helper