Fixing some minor issues
Some minor refactoring