improved add functionality