Added runtime exception handling