Some refactor and add cases