Is there anyway these two operations can be handled in a single pass?