updated the code

cleaned code and accepting now args