Move things into util.{c,h}

Signed-off-by: Raul Gutierrez S <rgs@itevenworks.net>