Updated with comments and exception