minor improvement code documentation and stucture