Remove duplication code from compiler