Simplifies argument parsing and evaluation. Fixes a problem with nan floats. Fixes some testcases.