Tiny patch for performance and code cleanup