use tuple to replace point struct
refactoring code