updated code to create stackoverflow question