Refactoring runtime datastructures