restructing functions