Add a simple error handling and more consts.