Put into a function, added parameters so we can run the alg with different landmarks and sigmas.
Still needs a lot of explanation; mostly the implementation is there for now.