quite much changes
refactoring and modulerazing code