improve solution to work with any use case