refactoring more rubish