Refactor trap a little.