Changed internal functions to protected