up to last function working