Refactoring element modules, trying to generalize them