Visibility function added

Added function to update item visibility based on the currently selected
visibility toggle (i.e. completing an item when only active items are
selected will make it disappear)