added new features, and bunch of bugfixes