remove some duplication & unused code