Core functions and classes