started wtatage sampling function, still need to integrate and test