minor refactor + comments added