Created custom exception class to avoid unexpected behavior