Migrate advanced functions to separate file