Fixed public add function