fixed some memory leaks, better page display