direct merge of Ningri's changes; need to massage a bit
need to re-add the single-core functionality