fixed restructuring, will need to clean up later