refactored the create circle function