Reworking structures.js for easier usage and better error reporting