added prelim expansion code, needs a lot of work with resizing