cleaned code

one or two features more. Refactoring also done. obslote code also
deleted.