one last ugly function to write