Better hex implementation