Add exception catching