working base code