Cleaned up the source a bit.

Moved utility routines to a dedicated "utilities" file. Changed calls to `sprintf()` for concatenation to use `strcat()` instead as it's more standard and usually a bit faster.