Fixing up viewing code