Merged some local changes and added comments