Fixed bug in "what" cmd, cleaned up code.