First round of bugfixes + code cleanup + method research