*refactoring and some fixes
Some fixes and code refactoring 'Like a boss'