Moved from quelpa to my own functions. Sped up initialization.