kibrit refactor and cleanup