Made changes to fix duplication

This should improve codeclimate