cleanup and hex handling