Minor changes : Replaced throws clause with try-catch statements.