adding phasing module w/useful functions
adding function to calculate the qual of the best assignment