Find next free block function