Changed code structure from lines 41-45