Some comments and moved around stuff for clarity.