Some code cleanup

Use an enum for function type, not an int.
Use (void) for some functions that take no arguments.