Removed unused debugging messages
Use slightly better algorithm for random IDs