Refactor circle plugin