First working version with hash