completed basic version of the homework