fix slag application logic complexity