Some useful methods and functions