Cleaned up, added comments