code leanup, closes #14, closes #18