Fixing code style and exception messages