Add unique id counter and addObject method

Rename some variables named after protected names