fixed up/down functionality

corrected logic for replace items.
added todo: