clean-up of ProjectDatabase, minor perf improvements