refactors checkall button functionality for readability and stability