Refactor element transformers, add more tests