fixing scope of opts_array and removing unnecessary redundant handling