Adding more exceptions and logging