logic simlpification
merge with master