cleanup

code refactored.