Refactor bind and indexOf
Fix tests