Start to move code into plugins