refactor hazmat code a bit, much cleaner