Add wait time compression
Refactor related code