copy/pasted code from development

I started making this Dec 29th, 2012, so it already has a year of tweaks.