Code duplication fixed