fixed invalid hex code
put together utility method to Class