first attempt with length conversion