encapsulated local functions