major update

first steps to improved threading and a more logic structure.