Changed to a better way to remove '/' character at the end