Code was cleaned up according to the comments of reviewers