For CS 311 homework