System checked and works (before refactoring)