Refactoring keyspace widget