working on a try-catch mechanism