updated script to return results