Major code cleanup done, perfomance improved quite a bit!