Cleaned some code, inserted global Offset variables