various improvements

many fixes and improvements working towards a new and cleaner version