Code duplication & unused function