remove unnecessary method invocations