some modifications; add remove function for output objects