Made use of 2-dimensional $_POST arrays to clean up some code