Fixes, simplifications; when() is still broken
Wrote more tests for .local()