updated code structure