made some functions internals