More refactoring.
Removing now works properly.
Variables now start with ?
Implemented upsert and fixed some tests.