updated comments and changed order