Tidying stuff up.

Removing static function definitions, putting parameters in the
functions, placing declarations in a header file.