cleaned code for old version and added cleaning of related files