simplifie sql queries & fix typos