Improve code (see previous commit)