fixes, newfeatures, refactoring