more refactorings. loosing hope to finish that