Almost working fill time function