Merging Alex's changes with mine