Refactor whole structure