improving the new code a bit