Huge refactoring - now faster, reduce memory consumption, remove dependency from DS, significant reduce size of lib