Refine exclude dir generation

fixes #56 and #57