Added standalone function to allow for ajax calls