Added options to better control what happens when the subquery fails
Make attribute merging more pythnonic)