closes #69, closes #66 + few bugfixes