Implemented min max in template