Move Freestyle-specific functions from EM into Freestyle