Added on_slope function