more updates to make the code slightly better to read