made some minor changes that caused unability to compile main with g++, but worked with make...