refactor ricbin