Fixed style bugs and corrected exceptions