duration is in milliseconds