updated to use prototypes