Added oustide click handler, code cleanup, comments ...