integrating given code