min-max seem to work, but couple of bugs found - will take a look tomorrow after the lecture :) "