Fixed database operations by query, params, implemented deletion