Panic on impossible conditions, refactor some things for clarity