added beginning part of function