Some refactoring
Removed old code