some timing and trimming functions