write a custom len function