refactoring code, troubleshooting index-size, documentation