move id generator to util and nice fixes