modified the base code