Completed function to initislise physical memory and changed the managment structure to a stack