[TASK] Properly encode database input in the right place