Fixed include path, removed superfluous loop/sql