Simplified and Fixed up Hex Code