removes unnecessary instantiations, and removes the use of arrauy_push