need to write tests but might be partly working