working on 2d but still memory problems