added a logic for smooth bezier curve but not refactored.