Cleaned up code and added swap usage when calculating total memory usage