Update structure and mass refactor code - BUGGY