Cleaned up PKM viewer logic