Cleanup code, add 'goldblock'.

I haven't personally tested this, so it's likely there are some bugs.