Big cleanup v3

remove lots of unused code, standardize certain things, add optional arguments, etc.