Removed superfluous refresh() and clear() calls. Added extra comments.