Refactoring

A lot of code nices