Code

if the graph goes 'down' minval must be hanged instead