cleanup code
first fight with mutex