changed function definitions to use prototypes