Some strange hacks. Refactor needed.