Memory management now suits a pi better and Fixed bug in thread page