Improve modes handling