Adding SWI code, not finished yet.