simple factory source code