remove redundant data structure
more refactoring and fixes