add logging to addElement