Moved common use functions to the commons.c source.