Moved code to generate WHERE-clauses and execute SQL-code to private helper function to decrease redundancy, implemented update()-function (untested)