refactored getting and setting $selected property of a scope