Cleaned up expanded code.