Removed matrix multiplication for memory efficiency