Moved the code for buying fields into a function buyField.
Formatting.