Added unlock callback and debug mode.