refactored src for cbuddy -rachit