trying to make code compatible with c++98 standard