mainly refactoring
Cannot find more to simplyfi now
..