Done minor refactoring