Changed code structure