some minor refactoring done