Use correct filename() function; finish merge