bugfixes and some redesign