Simple stack layout taken from  javadudejavadude