minor efficiency changes