Move structures to module.
Clean up code.