modification & add 2 new functions