cleaned up code, let's see if it still works