added some tests, some refactoring, covered some edgecases
deleted obsolete file