added calc logics