tweaked api db queries
optimized api db queries