refactored to different methods