Video 10 HW4 done main part. TODO extra credit, check my solution after sleep and maybe refactor