implementing main v1 main functino