Latest code from develop branch. closes #183