Fixed spam/LQ term typos. More minor refactorings.