some func made const
optimised a great deal.