Written some comments, cleaned up codes (minor)