Moved reverse(..) from tools.c to common.c