cleaned code and added proper "stop"