going through homeworks again and doing the basic logic