move fn definition at the end of the file