refactor autogenerate and add autopost