more refactors and general confusing oldstuff fixed