fixed indentation and added some brackets for readability