updated case logic