refactored the method to use dup instead of adding an empty array