tangential elastic force seems to work, but the program needs refactoring