Added return results data and fixed minor bugs.