Completed problem 23, cleaned up code

Also realized that problems 5 and 12 are incomplete (due to some weird
error on my part), will be fixing soon.