moved resource/element into struct.