Updated code structure a bit