Removes unnecessary duplication and fixes tests