Some methods and variables renamed to better indicate their function

General code appearance and function improvements

No functional change