Fix for SP names with spaces

Fix for SP names with spaces and removed unwanted variables