Fix a bug that affected visibility
Add an elegant refactory to dry up some code