Improve code a bit