some Refactorings for better understanding of code, some comments and
for better searching for the errors