Refactor scope keys module