updated code in constructor program