removed unnecessary copy and added/removed comments