refactor function a bit ch12
refactor function a bit ch12

raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning,raventid/coursera_learning