some code from internet for learning