finsihed up tests and refactors