priority and roundrobin support
refactor