Merged #3 and #4.

@gguuss please review this pull request. This merges #3 and #4.