Merge pull request #102 - second batch

merge bcse's commits (d148d70, 8eb0731, f93d593) with slight changes.