Move SANE code to a different file