code optimization and documentation arrangement