Tap to lock crash

There was still a problem with the tap to lock, as it assumed the fileindex existed. Had to do quite some refactoring to get everything working smoothly. Fixed one other bug along the way where the app couldn't boot up because the random cache file generator created a file with an empty filename.

Closes #142.