Improve solution for #2