added several operations; removed code duplications