Some refactoring

I dont know if  i like this my self, can i get some pointers or if you like it just pull.