Initial version with the if-else comparison
Added max-min functions instead of if-else condition