finish functionality
finish function