poczatek refactor + misc