better memory usage, general restructuring