Move TOLERANCE inside pertinent functions, change apply context from null to this, whitespace