fixed & improved common functions

Some common functions were slow because of bad design, contained garbage code or "polluted" global scope.
fixed tagMap of LineExtend

Some values weren't exact enough or just wrong
removed some useless code from Nudge.lua and put libraries in locals for faster access