Cleaner approach. Thanks teddyZ