intermediate function for testing