bug fixing, refactoring more data extraction