1st implementation of PLA algorithm