Fix extension malfunction bug with main functionality.
Minor code cleanup.