Moved common code to shared file
Now using common.cpp, benchmark from ~3s to ~1s