fix potentional memory leak, removed cout and moved testing file to a public location