Refactor and add cain