Implementing @adamv's comments