removed time() calls (originally for testing timing)