structure mostly debugged. tests to write