Remove duplicated code and update casebase