Code refactoring

Seems like everythings working as it should.. Next iteration please