merge changes from kmudrick (fixes #4, see integration branch for details)