refactoring + fixed bug w/ struture saving