cleaned up code, but still cant swapping to work