refactored, added position offset in output
moved
added limited output interval