updated functions for PA2