[TASK] code cleanup
[TASK] improve code quality, add comments
[TASK] improve entity monitoring