incorporated constraint functions from nassime