Add test for stop() method. Refactor