Fix efficiency issues