first working version of library that uses key of variable lenght