Code cleanup, comments, minor interface design bug fixes