Big restructuring

restructure and keep bw-compatibility