add throw and removed old debug cout statements