merge logic into master