Refactor handle_checkin