Cleaned up a little. Added comments.