Many issues resolved.
Merge remote-tracking branch 'upstream/test' into test
Merge pull request #314 from gogolander/test

Improvements and bugs fixed