changed code formatting and moved autogenerate script to lib