Removed unnecessary allocation and computation