enhanced code a little