kalkdoser work
removed unused flags variable
added missing ifdefs