fixed brackets and added comments