Modify serialize function
Move plugin file to core