Refactor for simplicity, remove deprecated stuff
Remove commented code, fix indentation