try and catch coding added