* code cleanup & minor refactoring