moved code to separate files;
added template parameter for enabling/disabling functionality wrt filtering turns, removing turns, and the parameters of the assign policy;