Merge pull request #1 from danbeam/master

Initial code review
Fix undefined element errors.