Refactored, reorganized and added gallery viewer.