updated unique_array function & minor changes