Added hex validation logic
Improved style