Modified / fixed some builtin functions and added tests for more complex example use cases.