Refactor, use structs.

For @ydnar