You've defined $opts twice here - perhaps explain you need to remove one of them in comments?