Code cleanup, offset calculation improvements, fixed issue concerning label offset (issue #122).
More bugfixes concerning the offset calculation.