almost fix with data structures