[FIX] added missing export macros and moved some more code from headers to cpp