Some documentation and neatening of codec