some useful extension methods.