code structure improvements