Refactoring things

Just a bit more code cleanup. Still wondering where some of the numbers are coming from though -- figuring that out could help make some nice DRY loops :)
good catch. definitely meant margin