Added few functions and modified the expect min max algo