removed capsule code duplication