enhancement

separated mixed functionality in same function to different
functionality