added logic stuff