Split that function up