added support for different min and max weights, updated example program