add TODO improve/add control of memory usage