Minor cleanup

Fixed a bunch of notices and a small efficiency tweak.
Merge pull request #28 from zbtirrell/updates

Minor cleanup