pretty much done. maybe except for any possible main() fixes, and the bonus