Some possible performance improvements