Updated Q and E logic