refactor add/remove obj code