Commented most of the esoteric lines and javadoced the helper method and listener implementation.