Add comments and exercises, clean up code a bit