fix compile issues
refactored code