Making modals work in correct order