Implemented improvements to the algorithm, and listener structure