extract algorithms to a separate script