Moved elements data, and refactored some utility functions.