Refactor: Fine tune element writing