add codefactory, improve some codes