implemented the offset command

+ more minor cleanings