exceptions and unused code cleanup