Simplified the template implementation of List and Map.