Use built-in funds for means and cove. Seems to have fixed the errors I was encountering
Update test
Tidy up debug code, add perplexity function