add function to manager.sql