finish homework10 (homework.sql), restructure code