added query in main, final fixes nlj