Merged in Illuminarti's fixes to prime