move slug related functions to slug.c and slug.h