Added implementation for add function