First crack at doing optimized routines for QMC. Seems to work, but could benefit from more little optimizations. Performance benefits not super obvious as of yet.