Code cleanup, added comments
merge conflict