Merging texture changes

Merging jgcode changes to texture.

Lots of formatting and comment changes, and unit test was verified as functional.