added finish function to h