improve performance and decrease memory use