completes functions for issue #597 and also fixes #422, allowing binary ops in constraints