cleanup / code deduplicate