bugfixes
working on reducing memory requirements