completed logic