Upgrade code style, annotation loading and error handling