Extract methods for writing elements