Improved test and made through sql