remove building struct stuff

no algorithmic changes, this is purely vanity.
i came back to look at this the other day and had a hard
time figuring out what the hell I had done. so hopefully this helps,
this uses parameters and returns so that each function's purpose
can easily be reasoned about from its signature. next time, smack me plz
Merge pull request #3 from rdallman/cleanup-mess

remove building struct stuff