added build type dependent compiler flags
reworked quite a lot of the data structures