changed all calls to checkArgument and checkState to use error message template to make sure strings are only build when actually needed