Added code help from internet.