updated both functions for a2