Remove duplication and complexity