Replace hashtables with hashmaps and add generic types.