start refactoring
some refactoring
version with many bugs