Fixed display refresh, added some comments.