Cleaned up and commented code for blog entry