added extensible function for different handle len

Needs to be tested