Updated to support all functions