refactored split to take care of space (removed some gsubs and strips)