Cleaned up some variable names and code