Added arguments to callback functions for greater versatility.